package cn.webrx;

import java.util.*;

public class List7 {
    public static void main(String[] args) {
        List<Integer> list1 = new ArrayList<>(List.of(1, 10, 2, 5, 3, 9, 7, 0, 50));
        System.out.println(list1);
        Collections.sort(list1);
        System.out.println(list1);
        Collections.sort(list1,(a,b)->b-a);
        System.out.println(list1);
        Collections.shuffle(list1);
        System.out.println(list1);

        List<String> list2 = Arrays.asList("java","php","c","c++","html");
        System.out.println(list2);
        Collections.sort(list2);
        System.out.println(list2);
        Collections.sort(list2,(a,b)->b.compareTo(a));
        System.out.println(list2);

        Collections.shuffle(list2);
        System.out.println(list2);

        Collections.sort(list2,(a,b)->a.length()-b.length());
        System.out.println(list2);

        Collections.sort(list2,(a,b)->b.length()-a.length());
        System.out.println(list2);
    }
}
